<template>
    <div style="background-image: url('../../assets/bg.jpg')">
  <el-row>
    <el-col :span="24">
      <el-table
              :data="tableData"
              @row-click="rowclick"
              style="width: 100%;border-radius: 7px">
        <el-table-column
                prop="name"
                label="城市名称"
                width="180">
        </el-table-column>
        <el-table-column
                prop=""
                label="地址">
        </el-table-column>
      </el-table>
    </el-col>
    <el-col :span="24" style="padding-top: 20px">
      <el-table
              :data="tableData1"
              style="width: 100%;">
        <el-table-column
                prop="date"
                label="日期"
                width="180">
        </el-table-column>
        <el-table-column
                prop="name"
                label="姓名"
                width="180">
        </el-table-column>
        <el-table-column
                prop="address"
                label="地址">
        </el-table-column>
      </el-table>
    </el-col>

  </el-row>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                selectrowid:'',
                /*tableData: [{
                    id:1,
                    date: '2016-05-02',
                    name: '王小虎',
                    address: '上海市普陀区金沙江路 1518 弄'
                }, {
                    id:2,
                    date: '2016-05-04',
                    name: '王小虎',
                    address: '上海市普陀区金沙江路 1517 弄'
                }, {
                    id:3,
                    date: '2016-05-01',
                    name: '王小虎',
                    address: '上海市普陀区金沙江路 1519 弄'
                }, {
                    id:4,
                    date: '2016-05-03',
                    name: '王小虎',
                    address: '上海市普陀区金沙江路 1516 弄'
                }],*/
                tableData: [{}],
                tableData1: []
            }
        },
        created:function () {
          let url = BASE_URL + "li";
          this.$http.get(url).then(function (data) {
              this.tableData = data.body
          })
        },
        methods: {
            rowclick(row) {
               //console.log(row);
                if(row.id==1){
                    this.tableData1= [{
                        date: '2016-05-02',
                        name: '王小虎',
                        address: '上海市普陀区金沙江路 1518 弄'
                    }, {
                        date: '2016-05-04',
                        name: '王小虎',
                        address: '上海市普陀区金沙江路 1517 弄'
                    }]
                }
                else{
                    var this1=this;
                    this.$http.get(
                        '../data/list.json',{params:{abc:51616}}).then(function(res){
                        this1.tableData1= res.body.result.tableData;
                    })
                }
            }
        }
    }
</script>

